function handleIpcError() {
  console.warn("ipcRenderer is not available. Some features may not work.");
  return () => {};
}

const IpcRendererProxyHandler = {
  get(target, prop) {
    if (window.ipcRenderer && typeof window.ipcRenderer[prop] === 'function') {
      return window.ipcRenderer[prop].bind(window.ipcRenderer);
    }
    console.warn(`Method ${prop} is not available on ipcRenderer.`);
    return handleIpcError();
  },
};

if (!window.ipcRendererChannel) {
  window.ipcRendererChannel = new Proxy({}, IpcRendererProxyHandler) as any;
}